
/**
 * @en Registration method for the main process of Extension
 * @zh 为扩展的主进程的注册方法
 */
export const methods: { [key: string]: (...any: any) => any } = {
    /**
     * @en Generate the folder directory structure
     * @zh 生成文件夹目录结构
     */
     async CreateStructure() {
        /**
         * @en Folder array (parent directory must be in front of subdirectory)
         * @zh 文件夹数组（父目录位置需在子目录前）
         */
        let folders = [
            "/res",
            "/res/animations",
            "/res/scenes",
            "/res/audios",
            "/res/fonts",
            "/res/textures",
            "/resources",
            "/resources/prefabs",
            "/scripts",
            "/scripts/actor",
            "/scripts/ui",
            "/scripts/util",
        ]
        let record = true;
        /**
         * @en Loop creation
         * @zh 循环创建 
         */
        for (let i of folders) {
            let currentFolder = await Editor.Message.request("asset-db", "create-asset", "db://assets" + i, null)
            if (!currentFolder) {
                record = false;
            }
        }

        /**
         * @en Log information
         * @zh 打印信息
         */
        if (record) {
            console.log(`done`);
        } else {
            console.log(`incomplete done`);
        }
    }
};

/**
 * @en Hooks triggered after extension loading is complete
 * @zh 扩展加载完成后触发的钩子
 */
export function load() { }

/**
 * @en Hooks triggered after extension uninstallation is complete
 * @zh 扩展卸载完成后触发的钩子
 */
export function unload() { }
